<?php 
namespace Think;

class Category {
    

	public function category($data,$pid=0,$t=0){
          
          $t++;
          foreach($data as $Key=>$val){

          	if($val['pid']==$pid){

          		$val['next'] = $this->category($data,$val['id'],$t);
          		$arr[] = $val; 
          	}
          }
          return $arr;
	}
}
 ?>
